<?php

class WxLog
{
    public static function writeLog($xml, $flag)
    {
        $flagStr = $flag == 1 ? '接收' : '发送';
        $separator = "--------------------------------------------------------------------------------------------- \n";
        $header = "【".$flagStr."】" .'  '. date('Y-m-d H:i:s') . "\n";
        $body = $xml;
        $log = $separator . $header . $body ."\n". $separator;
        file_put_contents('./log/'. date('Y-m-d') .'.log', $log, FILE_APPEND);
        return true;
    }
}